<?php
defined('_AppMiage') or die('Restricted access');
include_once (DS . 'include/header.php');
include_once (DS . 'include/menu.php');

$lstOffres = Offre::getListPortailOffreDesc($nbrResultPerPage, 0);
$count = Offre::affichageCount();
?>
<div id="content">
    <?php
    if (empty($lstOffres))
    {
        echo '<h2 class="title">Actuellement aucune offre n\'est disponible.</h2>';
    }
    else
    {
        $i = 1;
        ?>
        <div id="loadingOffre" style="display:none"><img src="<?php echo STYLE; ?>images/loading-bar.gif" /></div>
        <div id='listOffres'>
        <?php
        foreach ($lstOffres as $o)
        {
            $offre = new Offre($o->IdOffre);
            $contactEntreprise = new ContactEntreprise($offre->getIdContactEntreprise());
            $entreprise = new Entreprise($contactEntreprise->getIdEntreprise());
            ?>
            <div class="post <?php if($i%2==0){echo 'post-even'; }?>">
                <h2 class="title"><a href="<?php echo URL."/index.php?m=view_offre&id=".$offre->getIdOffre(); ?>" rel="bookmark" title="Visualiser l'offre"><?php echo stripcslashes($offre->getTitreOffre()); ?></a></h2>
                <div class="subtitleoffre">
                    <label>Entreprise :</label> <a href="#" class="link"><?php echo stripcslashes($entreprise->getNomEntreprise()); ?></a>
                    <label  style="margin-left:10px;">Domaine :</label> <a href="#" class="link"><?php $dom = new DomaineApplication($offre->getIdDomaineApplication()); echo $dom->getNomDomaineApplication();?></a>
                    <label  style="margin-left:10px;">Ville :</label> <a href="#" class="link"><?php echo stripcslashes($entreprise->getVilleEntreprise()); ?></a>
                </div>
                <div class="entry">
                    <?php echo Tools::add_more(stripcslashes($offre->getDescriptionOffre())); ?><br/>
                    <div class="readmore">
                        <strong><a href="<?php echo URL."index.php?m=view_offre&id=".$offre->getIdOffre(); ?>" rel="bookmark" title="Visualiser l'offre">Plus de d&eacute;tails &raquo;</a></strong>
                    </div>
                </div>
            </div>
            <?php
            $i += 1;
        }?>
       </div>
        </div>
		<?php include_once (DS . 'include/sidebar.php');?>
        <div class="navigation">
            <input type="button" id="moreResult" class="green button" value="Plus de r&eacute;sultat">
            <input type="hidden" name="maxResult" id="maxResult" value="<?php echo $count; ?>" />
            <input type="hidden" name="isResearch" id="isResearch" value="0" />
        </div>
    <?php } ?>
</div>
<?php

include_once (DS . 'include/footer.php');
?>